package com.stx.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.stx.jdbc.JdbcUtil;

public class LoginDao {
	public String getUserid(String uname,String upwd ){
		Connection con=null;
		PreparedStatement pst=null;
		try {
			con=JdbcUtil.getCon();
			pst=con.prepareStatement("select userid from tbl_manager where uname=? and upwd=?");
			pst.setString(1,uname);
			pst.setString(2, upwd);
			ResultSet rs=pst.executeQuery();
			if(rs.next()){
				return rs.getString("userid");
			}
		} catch (ClassNotFoundException | SQLException e) {
			e.printStackTrace();
		}finally{
			JdbcUtil.closeCon(con, pst);
		}
		return null;
	}
}
